import { Button, Slider, GroupBox, HorizontalBox, VerticalBox, TextEdit, LineEdit } from "std-widgets.slint";

export global GlobalVariables {
    in-out property <string> logstring: "";
    in-out property <string> atcmd: "";
    pure callback sendcmd(string);
}

export component MainWindow inherits Window {
    width: 800px;
    height: 580px;
    VerticalBox {
        x:0px;
        y:0px;
        height: 550px;
        logwindow := TextEdit {
            width:parent.width;
            height: 500px; 
            text: GlobalVariables.logstring;

        }
        HorizontalBox {
            width: parent.width;
            height: 50px;
            cmdinput := LineEdit {
                width:parent.width - 100px;
                height: 40px;
                text: GlobalVariables.atcmd;
            }
            Button {
                width: 60px;
                height: 40px;
                text: "Send";
                clicked => {
                    GlobalVariables.sendcmd(cmdinput.text);
                }
            }  
        }
    }
}